package com.block.datapush.form.factory;

import com.block.common.util.ApplicationContextUtil;
import com.block.datapush.form.service.IFormPushHandle;
import com.block.datapush.form.item.*;

import java.util.HashMap;
import java.util.Map;

public class FormPushFactory {

    private static Map<String, Class<? extends IFormPushHandle>> serviceMap = new HashMap<>();
    static {
        serviceMap.put("HAPPY", HappyPushHandleService.class);
        serviceMap.put("HUIZHONG", HuiZhongPushHandleService.class);

        serviceMap.put("DAJINDAI", DaJinDaiPushHandleService.class);
        serviceMap.put("BAINIAO", BaiNiaoPushHandleService.class);
        serviceMap.put("RONGXINDAI", RongXinDaiPushHandleService.class);


        serviceMap.put("YIXINHUA", YiXinHuaPushHandleService.class);
        serviceMap.put("YUNMIAODAO", YunMiaoDaoPushHandleService.class);

        serviceMap.put("ZHONGXIN", ZhongXinPushHandleService.class);

        serviceMap.put("YIXIN", YiXinPushHandleService.class);

        serviceMap.put("HAOHUITUI", HaoHuiTuiPushHandleService.class);


        serviceMap.put("XINERDAI", XinErDaiPushHandleService.class);

        serviceMap.put("DIANDAI", DianDaiPushHandleService.class);
        serviceMap.put("DIANDAI2", DianDaiTWOPushHandleService.class);

        serviceMap.put("ZAIYANG", ZaiYangPushHandleService.class);

        serviceMap.put("RONGFENQI", RongFenQiPushHandleService.class);

        serviceMap.put("JINRIFENQI", JinRiFenQiPushHandleService.class);

        serviceMap.put("YIJIE", YiJiePushHandleService.class);

        serviceMap.put("ZIWEIHUA", ZiWeiHuaHandleService.class);

        serviceMap.put("DIANDAI3", DianDaiTHREEPushHandleService.class);

        serviceMap.put("BAIXIANGRONG",BaiXiangRongHandleService.class);
        serviceMap.put("HAPPYTWO",HappyTwoPushHandleService.class);
        serviceMap.put("XINDIANDAI",XinDianDaiPushHandleService.class);

    }

    public static IFormPushHandle getService(String filterKey){
        if (serviceMap.containsKey(filterKey)){
            Class<? extends IFormPushHandle> aClass = serviceMap.get(filterKey);
            return ApplicationContextUtil.getBean(aClass);
        }
        return null;
    }
}
